#include <cstdio>
#include <cstring>
#include <deque>
#include <vector>

const int N = 1010;
int n, m, c;
int val[N], dis[N][N << 2];
bool vis[N][N << 2];
std::vector<int> e[N];
std::deque<std::pair<int, int> > q;

inline void add(int u, int v) { e[u].push_back(v); }

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#endif
#ifndef LOCAL
  freopen("P6005(分层图最短路).in", "r", stdin);
  freopen("P6005(分层图最短路).out", "w", stdout);
#endif
#endif

  scanf("%d%d%d", &n, &m, &c);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &val[i]);
  }
  int u, v;
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &u, &v);
    add(u, v);
  }
  memset(dis, -0x3f, sizeof(dis));
  q.push_back(std::make_pair(1, 0));
  dis[1][0] = 0;
  vis[1][0] = true;
  while (!q.empty()) {
    int u = q.front().first, d = q.front().second;
    q.pop_front();
    for (auto i = e[u].begin(); i != e[u].end(); ++i) {
      int v = *i, cost = dis[u][d] + val[v] - c * ((d << 1) + 1);
      if (dis[v][d + 1] < cost) {
        dis[v][d + 1] = cost;
        if (!vis[v][d + 1]) {
          q.push_back(std::make_pair(v, d + 1));
          vis[v][d + 1] = true;
        }
      }
    }
  }
  int ans = -0x3fffffff;
  for (int i = 0; i <= 4000; ++i) {
    ans = std::max(ans, dis[1][i]);
  }
  printf("%d", ans);
  return 0;
}